<template>
  <div id="landxqlist"> 


         <el-table :data="data" style="width: 100%" :height="dtheight" :header-cell-style="{background:'#4F81BC',color:'white'}"
           :row-class-name="tableRowClassName"  :border="true">
 
                
                <el-table-column label="生成时间"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.createtime }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="标的类别"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.manor_title }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="标的编号"  align='center' >                   
                    <template slot-scope="scope">
                        <span v-if="scope.row.exchange == 1">{{ scope.row.pid }}</span>                   
                        <span v-else></span>
                    </template>
                </el-table-column>
                 <el-table-column label="标的价值"  align='center' >                   
                    <template slot-scope="scope"> 
                        <span v-if="scope.row.exchange == 1">{{ scope.row.init_price }}</span>
                        <span v-if="scope.row.exchange == 0">
                               <span v-if="scope.row.invalid == 0">
                                   <span v-if="getTime(getTime_fm()) < getTime(start)">
                                       <el-input v-model.number="scope.row.init_price" type="number" placeholder="请输入内容"
                                              @blur="blur_but(scope.row,scope.row.init_price,scope.$index)">
                                        </el-input>
                                   </span>
                                   <span v-if="getTime(start) < getTime(getTime_fm()) &&  getTime(getTime_fm())<getTime(end)">  
                                        <el-input v-model.number="scope.row.init_price" type="number" placeholder="请输入内容"  :disabled="true">
                                        </el-input>
                                   </span>
                                  <span v-if="getTime(getTime_fm()) > getTime(end)">
                                       <el-input v-model.number="scope.row.init_price" type="number" placeholder="请输入内容"
                                              @blur="blur_but(scope.row,scope.row.init_price,scope.$index)">
                                        </el-input>
                                  </span>  
                                   
                                </span>
                               <span v-if="scope.row.invalid == 1">{{ scope.row.init_price }}</span>
                        </span>        
                    </template>
                </el-table-column>
                  <el-table-column label="兑换状态"  align='center' >                   
                    <template slot-scope="scope">               
                        <span v-if="scope.row.exchange == 1">已兑换</span>
                        <span v-if="scope.row.exchange == 0">
                               <span v-if="scope.row.invalid == 0">未兑换</span>
                               <span v-if="scope.row.invalid == 1">已失效</span>
                        </span> 
                    </template>
                </el-table-column>
                 <el-table-column label="兑换时间"  align='center' >                   
                    <template slot-scope="scope"> 
                        <span v-if="scope.row.exchange == 1">{{ scope.row.updatetime }}</span>                  
                        <span v-else></span>
                    </template>
                </el-table-column>
                 <el-table-column label="兑换账号"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span  v-if="scope.row.exchange == 1">{{ scope.row.exchanged_user }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="兑换金蛋"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span v-if="scope.row.is_withdraw == 0">未兑换</span>
                        <span v-if="scope.row.is_withdraw == 1">已兑换</span>
                    </template>
                </el-table-column>
    
                   
  
            </el-table>  



   </div>
</template>

<script>

export default {
   name: 'landxqlist',
   props:{
      data:{  
        //type:Array,
       default:()=>[]
     },
     data1:{  
        //type:Array,
       default:()=>[]
     },
  },
  data () {
    return {
        dtheight:'500',  //窗口高度
        maid:'',
        start:'',
        end:''
    }
  },
   components:{

  },
  created(){
     this.dtheight = window.innerHeight - 515
     this.start = this.$route.query.start
     this.end = this.$route.query.end
  },
  mounted (){

  },
   watch: {
   
   },
  methods: {

    blur_but(row,num,index){
          //console.log(this.data1)
          if(num == this.data1[index]){
                //this.open1('请变更价值','warning')
                this.$emit('up_list_fun')
                return false
          }else if(num <= 0){
                this.open1('不能小于0','warning')
                this.$emit('up_list_fun')
                return false
          }else{
              
         this.$confirm('确定修改价值, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
         }).then(() => {
              this.post("/gdb/updateSomePrice", {
                    id:row.id,
                    price:num,
                }).then(res => {
                    if(res.error_code == 0){
                        this.open1(res.result,'success')  //提示框
                        this.$emit('up_list_fun')
                    }else {
                    this.open1(res.message,'warning')
                }

                })
                }).catch(() => {
                    this.$emit('up_list_fun')          
                });

          }

    }

  }
}
</script>


<style scoped>

</style>